<template>
    <el-menu
        :style="{ width: !isCollapse ? '220px' : '64px' }"
        active-text-color="#ffd04b"
        background-color="#545c64"
        class="aside-container"
        text-color="#fff"
        @open="handleOpen"
        @close="handleClose"
        :collapse="isCollapse"
        :default-active="active"
      >
        <p>{{ isCollapse ? 'DIDI' : 'DIDI陪诊' }}</p>
        <!-- 菜单项 -->
        <TreeMenu :index="1" :menuData="menuData"/>
    </el-menu>
</template>

<script setup>
import { reactive, computed } from 'vue'
import TreeMenu from './treeMenu.vue'
import { useRouter } from 'vue-router'
import { useMenuStore } from '@/store/menu'

const menuStore = useMenuStore()
const router = useRouter()
const isCollapse = computed(() => menuStore.isCollapse)
// 菜单树组件里面要渲染的菜单项数组
// const menuData = reactive(router.options.routes[0].children)
const menuData = computed(() => menuStore.routerList)
const active = computed(() => menuStore.menuActive)

const handleOpen = () => {

}
const handleClose = () => {

}
</script>

<style lang="less" scoped>
.aside-container {
    height: 100vh;
    p {
        font-size: 20px;
        text-align: center;
        height: 50px;
        line-height: 50px;
        color: #fff;
    }
}
</style>